//
//  JWPosterTopMovieCell.m
//  JWMovie
//
//  Created by Jorn.Wu on 15/7/22.
//  Copyright (c) 2015年 Jorn.Wu. All rights reserved.
//

#import "JWPosterTopMovieCell.h"
#import "UIImage+MultiFormat.h"
#import "JWMovieCellModel.h"

@interface JWPosterTopMovieCell ()


@end
@implementation JWPosterTopMovieCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        _imageBtn = [[UIButton alloc] initWithFrame:self.bounds];
        _imageBtn.highlighted = NO;
        [self addSubview:_imageBtn];
    }
    return self;
}

- (void)setMovieModel:(JWMovieCellModel *)movieModel{
    _movieModel = movieModel;
    
    NSString *urlStr = [_movieModel.images objectForKey:@"large"];
    NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlStr]];
    UIImage *bgImage = [UIImage sd_imageWithData:imageData];
    
    [self.imageBtn setBackgroundImage:bgImage forState:UIControlStateNormal];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
